home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 101-125 / scopedisk118 / cosmicquest / main.c < prev    next >
C/C++ Source or Header  |  1995-03-19  |  4KB  |  161 lines

  1. #include <functions.h>
  2. #include <exec/memory.h>
  3. #include <graphics/gfxbase.h>
  4. #include <graphics/rastport.h>
  5. #include <graphics/text.h>
  6. #include <intuition/intuitionbase.h>
  7. #include <stdio.h>
  8. #include <ctype.h>
  9. #include "defs.h"
  10.  
  11. #define ABOX(x1,y1,x2,y2) SetAPen(ConPort,GREENPEN);RectFill(ConPort,(long) 10*x1,(long) 5*y1+5,(long) 10*x2+9,(long) 5*y2+9)
  12. #define EBOX(x1,y1,x2,y2) SetAPen(ConPort,BLACKPEN);RectFill(ConPort,(long) 10*x1,(long) 5*y1+5,(long) 10*x2+9,(long) 5*y2+9)
  13.  
  14. struct NewScreen NScreen =
  15.   {
  16.   0,0,640,200,
  17.   3,
  18.   GREENPEN,WHITEPEN,
  19.   HIRES,
  20.   CUSTOMSCREEN,
  21.   NULL,
  22.   (UBYTE *) "Cosmic Conquest by (PD) Carl Edman",
  23.   NULL,
  24.   NULL
  25.   };
  26.  
  27. struct NewWindow NWindow =
  28.   {
  29.   0,0,
  30.   640,200,
  31.   GREENPEN,WHITEPEN,
  32.   VANILLAKEY|MOUSEBUTTONS,
  33.   BORDERLESS|BACKDROP|SIMPLE_REFRESH|NOCAREREFRESH|RMBTRAP|ACTIVATE,
  34.   NULL,
  35.   NULL,
  36.   NULL,
  37.   NULL,
  38.   NULL,
  39.   640,200,
  40.   640,200,
  41.   CUSTOMSCREEN
  42.   };
  43.  
  44. struct TextAttr NFont =
  45.   {
  46.   (STRPTR) "ruby.font",
  47.   (UWORD) 8,
  48.   (UBYTE) FS_NORMAL,
  49.   (UBYTE) FPF_DISKFONT
  50.   };
  51.  
  52. USHORT CrossPointer[] =
  53.   {
  54.   0x0000,0x0000,
  55.   0x8080,0x0000,
  56.   0x4100,0x0000,
  57.   0x2200,0x0000,
  58.   0x1400,0x0000,
  59.   0x0000,0x0000,
  60.   0x1400,0x0000,
  61.   0x2200,0x0000,
  62.   0x4100,0x0000,
  63.   0x8080,0x0000,
  64.   0x0000,0x0000,
  65.   0x0000,0x0000
  66.   };
  67.  
  68. struct NStar star[STARNO];
  69. struct NTask task[PLAYERNO][TASKNO+1];
  70. struct NCommData CommData[PLAYERNO];
  71. struct NGeneral general;
  72. struct Screen *ConScreen=NULL;
  73. struct Window *ConWindow=NULL;
  74. struct IntuitionBase *IntuitionBase;
  75. struct GfxBase *GfxBase;
  76. struct RastPort *ConPort;
  77.  
  78. int growth[PLANETNO]={3,5,7,8,7,6,4,2};
  79. int fline;
  80. int mode=-1,mode2=0,mode3=0;
  81. int file=-1;
  82. int waittime=-1;
  83.  
  84. main()
  85.   {
  86.   int i;
  87.   /* Opening Libs */
  88.   IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library",LIBRARY_VERSION);
  89.   if(IntuitionBase==NULL) cleanup("Unable to open intuition.library");
  90.   GfxBase = (struct GfxBase *) OpenLibrary("graphics.library",LIBRARY_VERSION);
  91.   if (GfxBase==NULL) cleanup("Unable to open graphics.library");
  92.   /* Opening Screen */
  93.   NScreen.Font=&NFont;
  94.   ConScreen=(struct Screen *) OpenScreen(&NScreen);
  95.   if (ConScreen==NULL) cleanup("Unable to open conscreen");
  96.   ScreenToFront(ConScreen);
  97.   ShowTitle(ConScreen,FALSE);
  98.   SetRGB4(&(ConScreen->ViewPort),BLACKPEN, 0L, 0L, 0L);    /* Black  */
  99.   SetRGB4(&(ConScreen->ViewPort),WHITEPEN,15L,15L,15L);    /* White  */
  100.   SetRGB4(&(ConScreen->ViewPort),GREENPEN, 0L, 9L, 0L);    /* Green  */
  101.   SetRGB4(&(ConScreen->ViewPort),OTHERPEN,15L,12L, 0L);    /* Orange */
  102.   SetRGB4(&(ConScreen->ViewPort),PLAYERPEN(0),15L, 2L, 0L);/* Red    */
  103.   SetRGB4(&(ConScreen->ViewPort),PLAYERPEN(1), 7L, 9L,15L);/* Blue   */
  104.   SetRGB4(&(ConScreen->ViewPort),PLAYERPEN(2),15L,15L, 2L);/* Yellow */
  105.   SetRGB4(&(ConScreen->ViewPort),PLAYERPEN(3), 0L,15L, 2L);/* Full Green */
  106.   SetRGB4(&(ConScreen->ViewPort),SPRITEPEN(0), 0L, 0L, 0L);/* Black  */
  107.   SetRGB4(&(ConScreen->ViewPort),SPRITEPEN(1), 5L,13L, 0L);/* Green  */
  108.   SetRGB4(&(ConScreen->ViewPort),SPRITEPEN(2),15L,15L,15L);/* White  */
  109.   SetRGB4(&(ConScreen->ViewPort),SPRITEPEN(3),15L,12L, 0L);/* Orange */
  110.   NWindow.Screen=ConScreen;
  111.   ConWindow=(struct Window *) OpenWindow(&NWindow);
  112.   if(ConWindow==NULL) cleanup("Unable to open ConWindow");
  113.   ConPort=ConWindow->RPort;
  114.   SetPointer(ConWindow,CrossPointer,9L,9L,-4L,-4L);
  115.   title();
  116.   conquest();
  117.   cleanup("OK.");
  118.   }
  119. cleanup(str)
  120. char *str;
  121.   {
  122.   puts(str);
  123.   if (file!=-1) close(file);
  124.   if (ConWindow) CloseWindow(ConWindow);
  125.   if (ConScreen) CloseScreen(ConScreen);
  126.   if (GfxBase) CloseLibrary(GfxBase);
  127.   if (IntuitionBase) CloseLibrary(IntuitionBase);
  128.   exit(1);
  129.   }
  130. title()
  131.   {
  132.   Move(ConPort,232L,10L);
  133.   Text(ConPort,"by",2L);
  134.   ABOX( 8, 0,15,15);
  135.   EBOX(10, 2,15,13);
  136.   ABOX(18, 8,25,15);
  137.   EBOX(20,10,23,13);
  138.   ABOX(24,16,25,16);
  139.   ABOX(28, 7,29,15);
  140.   ABOX(30, 8,33, 9);
  141.   ABOX(36, 2,37,15);
  142.   ABOX(38,14,39,15);
  143.   ABOX( 0,20, 7,35);
  144.   EBOX( 2,22, 7,33);
  145.   ABOX( 2,26, 5,27);
  146.   ABOX(10,28,17,35);
  147.   EBOX(12,30,15,33);
  148.   ABOX(16,22,17,27);
  149.   ABOX(20,27,21,27);
  150.   ABOX(20,28,29,35);
  151.   EBOX(22,30,23,35);
  152.   EBOX(26,30,27,35);
  153.   ABOX(32,28,39,35);
  154.   EBOX(34,30,37,33);
  155.   ABOX(38,36,39,36);
  156.   ABOX(42,28,47,35);
  157.   EBOX(44,30,45,35);
  158.   ABOX(42,27,43,27);
  159.   }
  160. #include "human.c"
  161.